package com.whty.cms.filewps.util;


import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

public class MysqlSource {
	private static JdbcTemplate jdbcTemplate;
	private static JdbcTemplate jdbcTemplate1;
	static {
		getJdbcTemplate();
		getJdbcTemplate1();
	}

	public static synchronized JdbcTemplate getJdbcTemplate(){
		if (jdbcTemplate != null) {
			return jdbcTemplate;
		}
		try {// 慧教云
			//吉林省	代理10.0.200.12:20840/rc	rc/72YG4ZEaxRZOTa
			//慧教云6.0 	代理10.0.200.12:29540/cmsuser1	 cmsuser1/jK@9Yd3rPwq
			//武汉		代理10.0.200.39:28550/rc			rc/A@8UhnfPo4d
			//成华7.0	代理10.0.200.15:29105/rc			rc/q6R(U9&QN_qorF
			//天喻云		代理10.0.200.12:29540/rc			rc/X@8SpKm4
			//人人通		10.0.200.12:3003/rrtbk			rrtbk/U9SwTh87o^S0sC
			DriverManagerDataSource dataSource=new DriverManagerDataSource();
//			dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
			dataSource.setDriverClassName("com.mysql.jdbc.Driver");
			dataSource.setUrl("jdbc:mysql://10.0.200.12:3003/rrtbk");
			dataSource.setUsername("rrtbk");
			dataSource.setPassword("U9SwTh87o^S0sC");
			jdbcTemplate=new JdbcTemplate(dataSource);
			return jdbcTemplate;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}


	//文件处理中心数据库
	public static synchronized JdbcTemplate getJdbcTemplate1(){
		if (jdbcTemplate1 != null) {
			return jdbcTemplate1;
		}
		try {
			//海淀172.16.8.99:15009/cmsdb 代理 192.168.30.48:41597
			//浙江10.129.60.228:3306/rc 代理 10.0.200.12:17703 rc/9_nVagtN_170
			DriverManagerDataSource dataSource=new DriverManagerDataSource();
			dataSource.setDriverClassName("com.mysql.jdbc.Driver");
//			dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
			dataSource.setUrl("jdbc:mysql://10.0.200.39:4940/cmsfile");
			dataSource.setUsername("cmsfile");
			dataSource.setPassword("YI@7672HJyqwp");
			jdbcTemplate1=new JdbcTemplate(dataSource);
			return jdbcTemplate1;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
